package com.huluwa.picture.model.vo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.huluwa.picture.model.entity.WebCollection;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @Classname WebCollectionVO
 * @Date 2025-02-01 0:33
 * @Created by luyifan
 */
@Data
public class WebCollectionVO implements Serializable {
    /**
     * id
     */
    @TableId
    private Integer id;

    /**
     * 分类
     */
    private String category;

    /**
     * 网站图标
     */
    private String icon;

    /**
     * 网址
     */
    private String link;

    /**
     * 网站名称
     */
    private String name;

    /**
     * 排序
     */
    private Integer order;


    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 是否可见 (0:不可见,1: 可见)
     */
    private Integer visible;


    /**
     * 对象类转VO
     */
    private UserVO userVO;

    private static final long serialVersionUID = 1L;

    public static  WebCollectionVO objToVO(WebCollection webCollection) {
        if (webCollection == null) {
            return null;
        }

        WebCollectionVO webCollectionVO = new WebCollectionVO();
        BeanUtils.copyProperties(webCollection, webCollectionVO);
        return webCollectionVO;
    }

    /**
     * 对象类转VO
     * @param webCollectionVO
     * @return
     */
    public static  WebCollection voToObj(WebCollectionVO webCollectionVO) {
        if (webCollectionVO == null) {
            return null;
        }

        WebCollection webCollection = new WebCollection();
        BeanUtils.copyProperties(webCollectionVO, webCollection);
        return webCollection;
    }
}
